package com.lifang.framework.beans.factory.support;

import com.lifang.framework.beans.factory.config.BeanDefinitionReader;
import com.lifang.framework.beans.factory.config.BeanDefinitionRegistry;
import com.lifang.framework.core.io.DefaultResourceLoader;
import com.lifang.framework.core.io.ResourceLoader;

/**
 * 资源加载默认抽象实现类
 */
public abstract class AbstractBeanDefinitionReader implements BeanDefinitionReader {

    /**
     * 资源注册器
     */
    private final BeanDefinitionRegistry registry;

    /**
     * 资源读取策略
     */
    private final ResourceLoader resourceLoader;

    protected AbstractBeanDefinitionReader(BeanDefinitionRegistry registry){
        this.registry = registry;
        this.resourceLoader = new DefaultResourceLoader();
    }

    public AbstractBeanDefinitionReader(BeanDefinitionRegistry registry, ResourceLoader resourceLoader) {
        this.registry = registry;
        this.resourceLoader = resourceLoader;
    }

    @Override
    public BeanDefinitionRegistry getRegistry() {
        return registry;
    }

    @Override
    public ResourceLoader getResourceLoader() {
        return resourceLoader;
    }

}
